package com.aaa.result;


import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Result {

    private Integer code;

    private String message;

    private Object data;
    //响应结果有成功失败两种，
    //响应成功（增删改）不需要返回数据
    public static Result success(String message){
        return new Result(1,message,null);
    }
    //响应成功（查询） 需要回传数据
    public static Result success(Object data){
        return new Result(1,"success",data);
    }
    //响应失败，只传信息
    public static Result error(String message){
        return new Result(2,message,null);
    }

}
